package subject_set.offer100;

/**
 * @author haomin
 * @date 2022/10/15 10:59
 **/
public class Offer28 {
    class Solution {
        public boolean isSymmetric(TreeNode root) {
            if(root == null) return true;
            return isTrue(root.left, root.right);
        }
        private boolean isTrue(TreeNode l, TreeNode r){
            if(l == null && r == null) return true;
            if(l == null || r == null) return false;
            return l.val == r.val && isTrue(l.left, r.right) && isTrue(l.right, r.left);
        }
    }
}